var js_version = 1.1;
(function (win, doc, version) {
    var len, RENDER_URL_PRE = "http://js.xtgreat.com/mz_ad_render_", RENDER_OBJ_PRE = "mzadx", RENDER_QUEUE_PRE = "__mz_render_data_queue", REQUEST_PARAM_QUEUE = "__mz_rpq";
    win.__MZ_SERVERS || (win.__MZ_SERVERS = {
        "MZHKY": {
            "url": "http://a.tpg.cn.miaozhen.com/a.gif",
            "callback": "window.__mz_collect_hky",
            "params": {}
        },
        "MZHKY3": {"url": "http://a.hpg.cn.miaozhen.com/a.gif", "callback": "window.__mz_collect_hky3", "params": {}},
        "MZTAC": {"url": "http://a.tac.miaozhen.com/a.gif", "callback": "window.__mz_collect_tac", "params": {}},
        "MZADX": {"url": "http://s.x.cn.xtgreat.com/ax", "callback": "window.__mz_collect_adx", "params": {}}
    });
    win.__mz_collect_hky = function (materials) {
        win.__mz_materials_collect(materials, "MZHKY")
    };
    win.__mz_collect_hky3 = function (materials) {
        win.__mz_materials_collect(materials, "MZHKY3")
    };
    win.__mz_collect_tac = function (materials) {
        win.__mz_materials_collect(materials, "MZTAC")
    };
    win.__mz_collect_adx = function (materials) {
        handle_media_callback(materials, "MZADX");
        win.__mz_iframe_callback && win.__mz_iframe_callback(materials);
        win.__mz_materials_collect(materials, "MZADX")
    };
    win.__mz_materials_collect = function (materials, server, flag) {
        var emap = {}, etype, eArr, material, constructor = materials.constructor;
        if (constructor == Array) {
            for (var i = 0, len = materials.length; i < len; i++) {
                material = materials[i];
                material["server"] = server;
                material["nodeId"] = win.__MZ_SERVERS[server].params[material.pid].nodeId;
                material["style"] = win.__MZ_SERVERS[server].params[material.pid].style;
                if (win.__MZ_SERVERS[server].params[material.pid].click_google) {
                    material["cm"].push(decodeURIComponent(win.__MZ_SERVERS[server].params[material.pid].click_google))
                }
                if (win.__MZ_SERVERS[server].params[material.pid].click_asci) {
                    material["cm"].push(decodeURIComponent(win.__MZ_SERVERS[server].params[material.pid].click_asci))
                }
                if (!win.__MZ_SERVERS[server].params[material.pid].renderstate) {
                    win.__MZ_SERVERS[server].params[material.pid].renderstate = true;
                    if (!flag) {
                        clearTimeout(win.__MZ_SERVERS[server].params[material.pid].timeout)
                    }
                } else {
                    if (!win.__MZ_SERVERS[server].params[material.pid].rendercover) {
                        continue
                    }
                }
                etype = material.etype;
                eArr = emap[etype];
                if (!eArr) {
                    eArr = emap[etype] = []
                }
                eArr.push(material)
            }
        } else {
            material = materials;
            material["server"] = server;
            material["nodeId"] = win.__MZ_SERVERS[server].params[material.pid].nodeId;
            material["style"] = win.__MZ_SERVERS[server].params[material.pid].style;
            if (win.__MZ_SERVERS[server].params[material.pid].click_google) {
                material["cm"].push(decodeURIComponent(win.__MZ_SERVERS[server].params[material.pid].click_google))
            }
            if (win.__MZ_SERVERS[server].params[material.pid].click_asci) {
                material["cm"].push(decodeURIComponent(win.__MZ_SERVERS[server].params[material.pid].click_asci))
            }
            if (!win.__MZ_SERVERS[server].params[material.pid].renderstate) {
                win.__MZ_SERVERS[server].params[material.pid].renderstate = true;
                if (!flag) {
                    clearTimeout(win.__MZ_SERVERS[server].params[material.pid].timeout)
                }
            } else {
                if (!win.__MZ_SERVERS[server].params[material.pid].rendercover) {
                    return
                }
            }
            etype = material.etype;
            eArr = emap[etype] = [];
            eArr.push(material)
        }
        pushDataToQueue(emap, "N");
        for (etype in emap) {
            reqJsByType(etype);
            pushDataToQueue(emap, etype)
        }
    };
    function handle_media_callback(materials, server) {
        var constructor = materials.constructor;
        if (constructor == Array) {
            for (var i = 0; i < constructor.length; i++) {
                var flag1 = materials[i].succ, flag2 = (materials[i].src != "");
                var callback = win.__MZ_SERVERS[server].params[materials[i].pid].callback;
                callback && callback(flag1, flag2)
            }
        } else {
            var flag1 = materials.succ, flag2 = (materials.src != "");
            var callback = win.__MZ_SERVERS[server].params[materials.pid].callback;
            callback && callback(flag1, flag2)
        }
    }

    function timeoutController(materials, server) {
        var len, constructor = materials.constructor;
        if (constructor == Array) {
            for (var i = 0, len = materials.length; i < len; i++) {
                if (!win.__MZ_SERVERS[server].params[materials[i].pid].renderstate) {
                    win.__mz_materials_collect(materials[i], server, false)
                }
            }
        } else {
            if (!win.__MZ_SERVERS[server].params[materials.pid].renderstate) {
                win.__mz_materials_collect(materials, server, false)
            }
        }
    }

    function pushDataToQueue(map, etype) {
        var emapx = map[etype];
        if (emapx) {
            win[RENDER_QUEUE_PRE + etype].push(emapx);
            delete map[etype];
            emapx = null
        }
    }

    function reqToServer(args) {
        var server = args["_srv"], materials = args["_material"], timeout = args["_timeout"], server_url = args["_baseurl"];
        if (server) {
            if (server_url) {
                createScript(server_url + getUrlParams(args))
            } else {
                createScript(win.__MZ_SERVERS[server]["url"] + getUrlParams(args))
            }
            if (materials) {
                if (!timeout) {
                    timeout = 5000
                }
                win.__MZ_SERVERS[server].params[materials.pid].timeout = setTimeout(function () {
                    timeoutController(materials, server)
                }, timeout)
            }
        }
    }

    function getUrlParams(args) {
        var result = "", l, arg, page = "", referrer = "", server;
        if (args && (l = args.l)) {
            server = args["_srv"];
            if (l.constructor == Array) {
                var nodeIds = args["_id"];
                for (var i = 0, len = l.length; i < len; i++) {
                    var n = l[i];
                    var params = {};
                    params["nodeId"] = (nodeIds ? nodeIds[i] : server + "_" + n);
                    params["renderstate"] = false;
                    if (!args["_rc"]) {
                        params["rendercover"] = false
                    } else {
                        params["rendercover"] = true
                    }
                    if (args["_callback"]) {
                        params["callback"] = args["_callback"]
                    }
                    if (args["_style"]) {
                        params["style"] = args["_style"]
                    }
                    if (args["_click_google"] && (args["_click_google"].indexOf("http") != -1)) {
                        params["click_google"] = args["_click_google"]
                    }
                    if (args["_click_asci"] && (args["_click_asci"].indexOf("http") != -1)) {
                        params["click_asci"] = args["_click_asci"]
                    }
                    win.__MZ_SERVERS[server].params[n] = params
                }
            } else {
                var params = {};
                params["nodeId"] = (args["_id"] ? args["_id"] : server + "_" + l);
                params["renderstate"] = false;
                if (!args["_rc"]) {
                    params["rendercover"] = false
                } else {
                    params["rendercover"] = true
                }
                if (args["_callback"]) {
                    params["callback"] = args["_callback"]
                }
                if (args["_style"]) {
                    params["style"] = args["_style"]
                }
                if (args["_click_google"] && (args["_click_google"].indexOf("http") != -1)) {
                    params["click_google"] = args["_click_google"]
                }
                if (args["_click_asci"] && (args["_click_asci"].indexOf("http") != -1)) {
                    params["click_asci"] = args["_click_asci"]
                }
                win.__MZ_SERVERS[server].params[l] = params
            }
            try {
                if (args["u"]) {
                    page = args["u"]
                } else {
                    page = encodeURIComponent(win.top.document.location.href)
                }
                if (args["f"]) {
                    referrer = args["f"]
                } else {
                    referrer = encodeURIComponent(win.top.document.referrer)
                }
            } catch (e) {
                page = encodeURIComponent(doc.referrer)
            }
            delete args["_srv"];
            delete args["_id"];
            delete args["u"];
            delete args["f"];
            delete args["_timeout"];
            delete args["_rc"];
            delete args["_baseurl"];
            delete args["_callback"];
            delete args["_material"];
            delete args["_style"];
            delete args["_click_google"];
            delete args["_click_asci"];
            for (arg in args) {
                result += "&" + arg + "=" + encodeURIComponent(args[arg])
            }
            result += "&c=" + win.__MZ_SERVERS[server]["callback"] + "&v=2";
            if (!args["r"]) {
                result += "&r=1"
            }
            result += "&f=" + referrer + "&u=" + page + "&mv=j" + version
        }
        return "?" + result.substr(1)
    }

    function reqJsByType(etype) {
        !win[RENDER_QUEUE_PRE + etype] && (win[RENDER_QUEUE_PRE + etype] = []);
        if (!win[RENDER_OBJ_PRE + etype] && etype !== "N") {
            var t = parseInt((new Date()).getTime() / 1000);
            var v = t - t % 300;
            createScript(RENDER_URL_PRE + etype + ".js?v=" + v)
        }
    }

    function createScript(src) {
        var js = doc.createElement("script"), fs = doc.getElementsByTagName("script")[0];
        js.charset = "utf-8";
        js.type = "text/javascript";
        js.async = true;
        js.src = src;
        fs.parentNode.insertBefore(js, fs)
    }

    function MZQueue() {
        this.push = function (param) {
            param.constructor == Object && reqToServer(param)
        }
    }

    function slog(url) {
        var n = "t_" + (new Date()).getTime() + Math.random() * 9999;
        var c = window[n] = new Image(1, 1);
        c.onload = (c.onerror = function () {
            window[n] = null
        });
        c.src = url + "&t=" + n;
        url = null;
        n = null;
        c = null
    }

    reqJsByType("N");
    !win[REQUEST_PARAM_QUEUE] && (win[REQUEST_PARAM_QUEUE] = []);
    if (win[REQUEST_PARAM_QUEUE].constructor == Array) {
        len = win[REQUEST_PARAM_QUEUE].length;
        while (len--) {
            reqToServer(win[REQUEST_PARAM_QUEUE].shift())
        }
        win[REQUEST_PARAM_QUEUE] = new MZQueue()
    }
})(window, document, js_version);
var mzadxN = (function (mzadxN, win, doc, version) {
    var isLoaded = false, onloadFunc = win.onload, materialMap = {}, RENDER_QUEUE_PRE = "__mz_render_data_queue", MZ_RSQ = "__mz_ad_rsq", PLAYER_URL = "http://js.xtgreat.com/mzad_rp.swf";
    var hasFlash = false;
    try {
        var fo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
        if (fo) {
            hasFlash = true
        }
    } catch (e) {
        if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] != undefined && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {
            hasFlash = true
        }
    }
    mzadxN.render = function (materials) {
        var i = 0, constructor, len;
        if (!materials) {
            return
        }
        constructor = materials.constructor;
        if (constructor == Array) {
            for (len = materials.length; i < len;) {
                mzadxN.render(materials[i++])
            }
        } else {
            if (constructor == Object) {
                dealTask(materials)
            }
        }
    };
    win.onload = function () {
        isLoaded = true;
        win.onload = onloadFunc;
        onloadFunc && onloadFunc.call(win)
    };
    win.__get_params = function (pid) {
        return materialMap[pid]
    };
    function sendToMonitor(arr, type, server) {
        var i = 0, img, len;
        for (len = arr.length; i < len;) {
            img = new Image();
            img.onload = img.onerror = function () {
            };
            img.src = prepareURL(arr[i++])
        }
    }

    function prepareURL(str) {
        if (str.indexOf(".miaozhen.com") < 0) {
            return str
        }
        if (str.indexOf("?") < 0) {
            str += "?"
        }
        var ch = str.slice(-1);
        if (!(ch == "?" || ch == "&")) {
            str += "&"
        }
        str += "mv=j" + version;
        return str
    }

    function renderMaterial(material, node) {
        var w = material.adw, h = material.adh, src = material.src, src_backup = material.src_backup, ldp = material.ldp, imp = material.pm, clk = material.cm, type = material.type, style = material.style, server = material.server, ad = ps = "", ldpFunc, clkFunc, maskDiv, needClkEvent = false, materialId = material.pid, flashId = server + "_OBJ_" + materialId, maskId = server + "_MASK_" + materialId, eventMask = '<div id="' + maskId + '" style="position:absolute;width:' + w + "px;height:" + h + 'px;cursor:pointer;background-color:rgb(255,255,255);opacity:0;filter:alpha(opacity=0);"></div>', flashCode = getFlashCode(src, ps, w, h, flashId, false);
        switch (type) {
            case"I":
                ad += eventMask + '<img height="' + h + '" width="' + w + '" border="0" src="' + src + '" style="width:' + w + "px;height:" + h + "px;line-height:" + h + 'px" />';
                break;
            case"F":
                if (!hasFlash && src_backup != undefined) {
                    ad += eventMask + '<img height="' + h + '" width="' + w + '" border="0" src="' + src_backup + '" style="width:' + w + "px;height:" + h + "px;line-height:" + h + 'px" />';
                    type = "I"
                } else {
                    ad += eventMask + flashCode
                }
                break;
            case"X":
                material.width = w;
                material.height = h;
                material.hc = 0;
                delete material.pm;
                materialMap[materialId] = material;
                ps = "pid=" + materialId;
                ad = getFlashCode(PLAYER_URL, ps, w, h, flashId, false);
                break;
            case"V":
                material.width = w;
                material.height = h;
                material.hc = 0;
                delete material.pm;
                materialMap[materialId] = material;
                ps = "pid=" + materialId;
                ad = getFlashCode(PLAYER_URL, ps, w, h, flashId, true);
                break;
            default:
                break
        }
        if (style) {
            var data = {};
            data.material = material;
            data.contentHTML = ad;
            pushDataToRenderStyleQueue(data)
        } else {
            node.style.width = w + "px";
            node.style.height = h + "px";
            node.innerHTML = ad
        }
        if (type == "I" || type == "F") {
            if (imp.constructor == Object) {
                var s0imp = imp["0"];
                if (s0imp && s0imp.constructor == Array) {
                    sendToMonitor(s0imp, "imp", server);
                    delete imp["0"]
                }
                for (var sec in imp) {
                    var sximp = imp[sec];
                    if (sximp.constructor == Array) {
                        (function (sximp, sec) {
                            win.setTimeout(function () {
                                sendToMonitor(sximp, "imp", server)
                            }, parseInt(sec) * 1000)
                        })(sximp, sec)
                    }
                }
            }
            maskDiv = doc.getElementById(maskId);
            if (ldp) {
                ldpFunc = function () {
                    win.open(ldp, "_blank")
                };
                needClkEvent = true
            }
            if (clk.constructor == Array) {
                clkFunc = function () {
                    sendToMonitor(clk, "clk", server)
                };
                needClkEvent = true
            }
            if (needClkEvent) {
                maskDiv && (maskDiv.onclick = function () {
                    clkFunc && clkFunc();
                    ldpFunc && ldpFunc()
                })
            }
        }
        if (type == "X" || type == "V") {
            if (imp.constructor == Object) {
                var s0imp = imp["0"];
                if (s0imp && s0imp.constructor == Array) {
                    sendToMonitor(s0imp, "imp", server);
                    delete imp["0"]
                }
                for (var sec in imp) {
                    var sximp = imp[sec];
                    if (sximp.constructor == Array) {
                        (function (sximp, sec) {
                            win.setTimeout(function () {
                                sendToMonitor(sximp, "imp", server)
                            }, parseInt(sec) * 1000)
                        })(sximp, sec)
                    }
                }
            }
        }
    }

    function dealTask(material) {
        var src = material.src;
        if (src.replace(/^\s+|\s+$/g, "") == "") {
            return
        }
        var node = doc.getElementById(material.nodeId);
        if (node) {
            renderMaterial(material, node)
        } else {
            if (!isLoaded) {
                win.setTimeout(function () {
                    dealTask.call(null, material)
                }, 50)
            }
        }
    }

    function pushDataToRenderStyleQueue(data) {
        win[MZ_RSQ] || (win[MZ_RSQ] = []);
        win[MZ_RSQ].push(data)
    }

    function RenderQueue() {
        this.push = function (materials) {
            materials.constructor == Array && mzadxN.render(materials)
        }
    }

    function getFlashCode(src, ps, w, h, flashId, rm) {
        var p = "", q = "";
        if (rm) {
            p = '<param name="allowFullScreen" value="true" />';
            q = 'allowfullscreen="true"'
        } else {
            p = '<param name="wmode" value="transparent" />';
            q = 'wmode="transparent"'
        }
        return '<object id="' + flashId + '" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ' + 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" ' + 'align="middle" width="' + w + '" height="' + h + '"> ' + p + ' <param name="allowScriptAccess" value="always" />' + '<param name="movie" value="' + src + '"/>' + '<param name="quality" value="high"/>' + '<param name="bgcolor" value="#000"/>' + '<param name="width" value="' + w + '" />' + '<param name="height" value="' + h + '" />' + (ps ? '<param name="FlashVars" value="' + ps + '" />' : "") + '<embed src="' + src + '" quality="high" ' + 'bgcolor="#000" width="' + w + '" height="' + h + '" ' + 'type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" ' + 'allowscriptaccess="always" loop="true" ' + q + ' name="' + flashId + '" ' + (ps ? 'flashvars="' + ps + '" ' : "") + "></embed></object>"
    }

    var queueN = win[RENDER_QUEUE_PRE + "N"];
    if (queueN && queueN.constructor == Array) {
        mzadxN.render(queueN);
        win[RENDER_QUEUE_PRE + "N"] = new RenderQueue()
    }
})(mzadxN || {}, window, document, js_version);
(function (win, doc) {
    var MZ_RSQ = "__mz_ad_rsq";
    var ie6 = false, less_than_ie9 = false, ua = navigator.userAgent;
    if (ua.indexOf("MSIE 6.0") > 0) {
        ie6 = true
    }
    function addEventHandler(target, eventType, handler, capture) {
        target.addEventListener ? target.addEventListener(eventType, handler, capture) : target.attachEvent && target.attachEvent("on" + eventType, handler)
    }

    function removeEventHandler(target, eventType, handler, capture) {
        target.removeEventListener ? target.removeEventListener(eventType, handler, capture) : target.detachEvent && target.detachEvent("on" + eventType, handler)
    }

    var mzPopAD = {
        properties: {div_id: "MZAD_POP_PLACEHOLDER", close_btn: "MZAD_POP_CLOSE_BTN"},
        show: function (material, contentHTML) {
            var popWin = doc.getElementById(mzPopAD.properties.div_id), width = material.adw, height = material.adh + 25;
            if (!popWin) {
                popWin = mzPopAD.createPopWin(width, height);
                var cb = mzPopAD.createCloseBtn(width);
                var c = mzPopAD.createContentDiv(width, height, contentHTML);
                popWin.appendChild(cb);
                popWin.appendChild(c);
                doc.body.appendChild(popWin)
            }
            popWin.style.width = width + "px";
            if (ie6) {
                popWin.style.height = height + "px"
            } else {
                popWin.style.height = "0px";
                GLOBAL_POP_ANIMATE = setInterval(function () {
                    mzPopAD.move(popWin, height)
                }, 2)
            }
        },
        move: function (el, height) {
            var popH = parseInt(el.style.height);
            if (popH < height) {
                el.style.height = (popH + 5).toString() + "px"
            } else {
                clearInterval(GLOBAL_POP_ANIMATE)
            }
        },
        createPopWin: function (width, height) {
            var popWin = doc.createElement("div");
            popWin.id = mzPopAD.properties.div_id;
            popWin.style.padding = "0px";
            popWin.style.display = "block";
            popWin.style.visibility = "visible";
            popWin.style.border = "medium none";
            popWin.style.background = "none repeat scroll 0% 0% transparent";
            popWin.style.cssFloat = "none";
            popWin.style.styleFloat = "none";
            popWin.style.overflow = "hidden";
            popWin.style.zIndex = "2147483647";
            if (ie6) {
                popWin.style.position = "absolute";
                popWin.style.left = (doc.documentElement.scrollLeft + doc.documentElement.clientWidth - width - 5).toString() + "px";
                popWin.style.top = (doc.documentElement.scrollTop + doc.documentElement.clientHeight - height).toString() + "px";
                addEventHandler(win, "scroll", mzPopAD.fixedIE6Position);
                addEventHandler(win, "resize", mzPopAD.fixedIE6Position)
            } else {
                popWin.style.position = "fixed";
                popWin.style.right = "5px";
                popWin.style.bottom = "5px"
            }
            return popWin
        },
        createCloseBtn: function (width) {
            var cb = doc.createElement("div");
            cb.id = mzPopAD.properties.close_btn;
            cb.style.position = "absolute";
            cb.style.width = "61px";
            cb.style.height = "20px";
            cb.style.top = "0px";
            cb.style.left = (width - 61).toString() + "px";
            cb.style.margin = "0px 0px 5px";
            cb.style.padding = "0px";
            cb.style.cursor = "pointer";
            cb.style.overflow = "hidden";
            var subDiv = doc.createElement("div");
            subDiv.style.width = "40px";
            subDiv.style.height = "20px";
            subDiv.style.backgroundColor = "rgb(153, 153, 153)";
            subDiv.style.color = "rgb(255, 255, 255)";
            subDiv.style.cssFloat = "left";
            subDiv.style.styleFloat = "left";
            subDiv.style.marginRight = "1px";
            subDiv.style.fontSize = "12px";
            subDiv.style.fontFamily = "微软雅黑";
            subDiv.style.textAlign = "center";
            subDiv.style.lineHeight = "20px";
            subDiv.innerHTML = "关闭";
            var link = doc.createElement("a");
            link.style.padding = "0px";
            link.style.display = "inline-block";
            link.style.border = "medium none";
            link.style.overflow = "hidden";
            link.style.height = "20px";
            link.style.lineHeight = "20px";
            link.style.cursor = "pointer";
            link.style.width = "20px";
            link.style.background = "url('http://js.xtgreat.com/close.png')";
            link.style.marginBottom = "3px";
            link.style.cssFloat = "left";
            link.style.styleFloat = "left";
            cb.appendChild(subDiv);
            cb.appendChild(link);
            addEventHandler(cb, "click", mzPopAD.close);
            return cb
        },
        createContentDiv: function (width, height, contentHTML) {
            var c = doc.createElement("div");
            c.style.width = width + "px";
            c.style.height = height + "px";
            c.style.overflow = "hidden";
            c.style.position = "absolute";
            c.style.left = "0px";
            c.style.top = "25px";
            c.innerHTML = contentHTML;
            return c
        },
        close: function () {
            var popWin = doc.getElementById(mzPopAD.properties.div_id);
            if (popWin) {
                var closeBtn = doc.getElementById(mzPopAD.properties.close_btn);
                closeBtn && removeEventHandler(closeBtn, "click", mzPopAD.close);
                if (ie6) {
                    removeEventHandler(win, "scroll", mzPopAD.fixedIE6Position);
                    removeEventHandler(win, "resize", mzPopAD.fixedIE6Position)
                }
                popWin.parentNode.removeChild(popWin)
            }
        },
        fixedIE6Position: function () {
            var popWin = doc.getElementById(mzPopAD.properties.div_id);
            if (popWin) {
                popWin.style.position = "absolute";
                popWin.style.left = (doc.documentElement.scrollLeft + doc.documentElement.clientWidth - popWin.offsetWidth - 5).toString() + "px";
                popWin.style.top = (doc.documentElement.scrollTop + doc.documentElement.clientHeight - popWin.offsetHeight).toString() + "px"
            }
        }
    };
    var mzCoupletAD = {
        properties: {
            MZAD_COUPLET_LEFT: "MZAD_COUPLET_LEFT",
            MZAD_COUPLET_RIGHT: "MZAD_COUPLET_RIGHT",
            MZAD_COUPLET_CLOSE_BTN_SUFFIX: "_CLOSE_BTN",
            MZAD_COUPLET_CONTENT_DIV_SUFFIX: "_CONTENT_DIV",
            MZAD_CLOSEBTN_HEIGHT: 18
        }, show: function (material, content, type) {
            var width = material.adw, height = material.adh;
            if (!type || type != 2) {
                var leftCouplet = this.createRootElement(width, height, mzCoupletAD.properties.MZAD_COUPLET_LEFT, content);
                document.body.appendChild(leftCouplet)
            }
            if (!type || type != 1) {
                var rightCouplet = this.createRootElement(width, height, mzCoupletAD.properties.MZAD_COUPLET_RIGHT, content);
                document.body.appendChild(rightCouplet)
            }
            if (ie6) {
                mzCoupletAD.resetRootElementPositionWithTimeout();
                addEventHandler(window, "resize", mzCoupletAD.resetRootElementPositionWithTimeout);
                addEventHandler(window, "scroll", mzCoupletAD.resetRootElementPositionWithTimeout)
            } else {
                mzCoupletAD.onWinResize();
                addEventHandler(window, "resize", mzCoupletAD.onWinResize)
            }
        }, createRootElement: function (width, height, elementId, contentInnerHtml) {
            var couplet = document.createElement("div");
            couplet.id = elementId;
            couplet.style.width = width + "px";
            couplet.style.height = height + mzCoupletAD.properties.MZAD_CLOSEBTN_HEIGHT + "px";
            couplet.style.zIndex = "66666";
            couplet.style.padding = "0px";
            couplet.style.display = "block";
            couplet.style.visibility = "visible";
            couplet.style.border = "none";
            couplet.style.cssFloat = "none";
            couplet.style.styleFloat = "none";
            couplet.style.overflow = "hidden";
            if (elementId == mzCoupletAD.properties.MZAD_COUPLET_LEFT) {
                couplet.style.left = "10px"
            } else {
                if (elementId == mzCoupletAD.properties.MZAD_COUPLET_RIGHT) {
                    couplet.style.right = "10px"
                }
            }
            if (ua.indexOf("MSIE 6.0") > 0) {
                couplet.style.position = "absolute";
                couplet.style.border = "none";
                couplet.style.background = "none transparent scroll repeat 0% 0%"
            } else {
                if (ua.indexOf("MSIE 8.0") > 0 || ua.indexOf("MSIE 7.0") > 0) {
                    couplet.style.position = "fixed";
                    couplet.style.border = "medium none";
                    couplet.style.background = "none transparent scroll repeat 0% 0%"
                } else {
                    couplet.style.position = "fixed";
                    couplet.style.backgroundPosition = "initial initial";
                    couplet.style.backgroundRepeat = "initial initial"
                }
            }
            couplet.appendChild(mzCoupletAD.createCloseBtn(width, height, elementId));
            couplet.appendChild(mzCoupletAD.createContentDiv(width, height, elementId, contentInnerHtml));
            return couplet
        }, createCloseBtn: function (width, height, elementIdPrefix) {
            var closeBtn = document.createElement("div");
            closeBtn.id = elementIdPrefix + mzCoupletAD.properties.MZAD_COUPLET_CLOSE_BTN_SUFFIX;
            closeBtn.style.position = "absolute";
            closeBtn.style.width = width + "px";
            closeBtn.style.height = mzCoupletAD.properties.MZAD_CLOSEBTN_HEIGHT;
            closeBtn.style.top = height + "px";
            closeBtn.style.cursor = "pointer";
            closeBtn.style.backgroundColor = "#999999";
            closeBtn.style.color = "#fff";
            closeBtn.style.fontSize = "12px";
            closeBtn.style.fontFamily = "微软雅黑";
            closeBtn.style.textAlign = "center";
            closeBtn.style.lineHeight = "20px";
            closeBtn.innerHTML = "关闭";
            addEventHandler(closeBtn, "click", mzCoupletAD.onAdClose);
            return closeBtn
        }, createContentDiv: function (width, height, elementIdPrefix, contentInnerHtml) {
            var contentDiv = document.createElement("div");
            contentDiv.id = elementIdPrefix + mzCoupletAD.properties.MZAD_COUPLET_CONTENT_DIV_SUFFIX;
            contentDiv.style.width = width + "px";
            contentDiv.style.height = height + "px";
            contentDiv.style.overflow = "hidden";
            contentDiv.innerHTML = contentInnerHtml;
            return contentDiv
        }, onAdClose: function (event) {
            event = event ? event : window.event;
            var targetElement = event.srcElement ? event.srcElement : event.target;
            removeEventHandler(targetElement, "click", mzCoupletAD.onAdClose);
            document.body.removeChild(targetElement.parentNode);
            var leftCouplet = document.getElementById(mzCoupletAD.properties.MZAD_COUPLET_LEFT);
            var rightCouplet = document.getElementById(mzCoupletAD.properties.MZAD_COUPLET_RIGHT);
            if (!leftCouplet && !rightCouplet) {
                removeEventHandler(window, "resize", mzCoupletAD.onWinResize);
                removeEventHandler(window, "resize", mzCoupletAD.resetRootElementPositionWithTimeout);
                removeEventHandler(window, "scroll", mzCoupletAD.resetRootElementPositionWithTimeout)
            }
        }, onWinResize: function () {
            var leftCouplet = document.getElementById(mzCoupletAD.properties.MZAD_COUPLET_LEFT);
            var rightCouplet = document.getElementById(mzCoupletAD.properties.MZAD_COUPLET_RIGHT);
            var winHeight = 0;
            if (document.documentElement && document.documentElement.clientHeight) {
                winHeight = document.documentElement.clientHeight
            } else {
                if (window.innerHeight) {
                    winHeight = window.innerHeight
                } else {
                    if ((document.body) && (document.body.clientHeight)) {
                        winHeight = document.body.clientHeight
                    }
                }
            }
            if (leftCouplet) {
                if (winHeight >= leftCouplet.offsetHeight) {
                    leftCouplet.style.top = (winHeight - leftCouplet.offsetHeight) / 2 + "px"
                } else {
                    leftCouplet.style.top = "0px"
                }
            }
            if (rightCouplet) {
                if (winHeight >= rightCouplet.offsetHeight) {
                    rightCouplet.style.top = (winHeight - rightCouplet.offsetHeight) / 2 + "px"
                } else {
                    rightCouplet.style.top = "0px"
                }
            }
        }, resetRootElementPositionWithTimeout: function () {
            setTimeout(mzCoupletAD.resetRootElementPosition, 100)
        }, resetRootElementPosition: function () {
            var leftCouplet = document.getElementById(mzCoupletAD.properties.MZAD_COUPLET_LEFT);
            var rightCouplet = document.getElementById(mzCoupletAD.properties.MZAD_COUPLET_RIGHT);
            var winHeight = 0;
            if (document.documentElement && document.documentElement.clientHeight) {
                winHeight = document.documentElement.clientHeight
            } else {
                if (window.innerHeight) {
                    winHeight = window.innerHeight
                } else {
                    if ((document.body) && (document.body.clientHeight)) {
                        winHeight = document.body.clientHeight
                    }
                }
            }
            if (leftCouplet) {
                leftCouplet.style.left = document.documentElement.scrollLeft + 10 + "px";
                if (winHeight >= leftCouplet.offsetHeight) {
                    leftCouplet.style.top = document.documentElement.scrollTop + (doc.documentElement.clientHeight - leftCouplet.offsetHeight) / 2 + "px"
                } else {
                    leftCouplet.style.top = document.documentElement.scrollTop + "px"
                }
            }
            if (rightCouplet) {
                rightCouplet.style.left = document.documentElement.scrollLeft + doc.documentElement.clientWidth - rightCouplet.offsetWidth - 10 + "px";
                if (winHeight >= rightCouplet.offsetHeight) {
                    rightCouplet.style.top = document.documentElement.scrollTop + (doc.documentElement.clientHeight - rightCouplet.offsetHeight) / 2 + "px"
                } else {
                    rightCouplet.style.top = document.documentElement.scrollTop + "px"
                }
            }
        }
    };

    function MZAD_RSQ() {
        this.push = function (params) {
            show(params)
        }
    }

    function show(params) {
        if (params.constructor == Object) {
            if (params.material.style == "pop") {
                mzPopAD.show(params.material, params.contentHTML)
            } else {
                if (params.material.style == "couplet") {
                    mzCoupletAD.show(params.material, params.contentHTML)
                }
            }
        }
    }

    !win[MZ_RSQ] && (win[MZ_RSQ] = []);
    if (win[MZ_RSQ].constructor == Array) {
        var len = win[MZ_RSQ].length, params;
        while (len--) {
            show(win[MZ_RSQ].shift())
        }
        win[MZ_RSQ] = new MZAD_RSQ()
    }
})(window, document);